package com.oreilly.ez.base;

import org.joda.time.DateTime;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class Jobs {

    public final static long ONE_Minute = 60 * 1000;

    @Scheduled(fixedDelay = ONE_Minute)
    public void fixedDelayJob() {
        System.out.println(DateTime.now().toString("yyyy-MM-dd HH:mm:ss") + " >>fixedDelay执行....");
    }

    @Scheduled(fixedRate = ONE_Minute)
    public void fixedRateJob() {
        System.out.println(DateTime.now().toString("yyyy-MM-dd HH:mm:ss") + " >>fixedRate执行....");
    }

    @Scheduled(cron = "0 15 3 * * ?")
    public void cronJob() {
        System.out.println(DateTime.now().toString("yyyy-MM-dd HH:mm:ss") + " >>cron执行....");
    }
}
